
#ifndef VEC2_H
#define VEC2_H

#include <string>

namespace solar
{

    class Vec2
    {
        public:
            Vec2() = default;
            Vec2(double x, double y) : e_{x, y} {};

            [[nodiscard]] double x() const { return e_[0]; }
            [[nodiscard]] double y() const { return e_[1]; }
            void setX(double x) { e_[0] = x; }
            void setY(double y) { e_[1] = y; }

            auto operator[](int index) -> double& { return e_[index]; }

            [[nodiscard]] auto toString() const -> std::string;
            static auto fromString(const std::string& input) -> Vec2;
            [[nodiscard]] auto hasValue() const -> bool;

        private:
            double e_[2];
    };

} // namespace solar
// Q_DECLARE_METATYPE(solar::Vec2)

#endif // VEC2_H
